import request from '@/utils/request'

// 团长列表
export function listLeaders(query) {
  return request({
    url: '/leader/page',
    method: 'get',
    params: query
  })
}

// 获取团长详情
export function getLeader(id) {
  return request({
    url: `/leader/${id}`,
    method: 'get'
  })
}

// 新增团长
export function addLeader(data) {
  return request({
    url: '/leader',
    method: 'post',
    data: data
  })
}

// 修改团长
export function updateLeader(data) {
  return request({
    url: '/leader',
    method: 'put',
    data: data
  })
}

// 删除团长
export function deleteLeader(id) {
  return request({
    url: `/leader/${id}`,
    method: 'delete'
  })
}

// 更新团长状态
export function changeLeaderStatus(id, status) {
  return request({
    url: '/leader/status',
    method: 'put',
    params: {
      id,
      status
    }
  })
}

// 获取团长订单统计
export function getLeaderOrderStats(leaderId) {
  return request({
    url: '/leader/order-stats',
    method: 'get',
    params: {
      leaderId
    }
  })
}

// 获取团长佣金统计
export function getLeaderCommissionStats(leaderId) {
  return request({
    url: '/leader/commission-stats',
    method: 'get',
    params: {
      leaderId
    }
  })
}

// 获取团长仪表盘数据
export function getLeaderDashboardData(leaderId) {
  return request({
    url: '/leader/dashboard',
    method: 'get',
    params: {
      leaderId
    }
  })
}

// 获取团长佣金详情
export function getLeaderCommissionDetail(leaderId) {
  return request({
    url: '/leader/commission-detail',
    method: 'get',
    params: {
      leaderId
    }
  })
}

// 团长注册
export function registerLeader(data) {
  return request({
    url: '/leader/register',
    method: 'post',
    data: data
  })
} 